diabetes <- read.csv('C:/Users/Dell/Downloads/diabetes.csv')
head(diabetes)
## Pregnancies Glucose BloodPressure SkinThickness Insulin BMI
## 1 6 148 72 35 0 33.6
## 2 1 85 66 29 0 26.6
## 3 8 183 64 0 0 23.3
## 4 1 89 66 23 94 28.1
## 5 0 137 40 35 168 43.1
## 6 5 116 74 0 0 25.6
## DiabetesPedigreeFunction Age Outcome
## 1 0.627 50 1
## 2 0.351 31 0
## 3 0.672 32 1
## 4 0.167 21 0
## 5 2.288 33 1
## 6 0.201 30 0
## Pregnancies Glucose BloodPressure SkinThickness Insulin BMI
## 1 6 148 72 35 0 33.6
## 2 1 85 66 29 0 26.6
## 3 8 183 64 0 0 23.3
## 4 1 89 66 23 94 28.1
## 5 0 137 40 35 168 43.1
## 6 5 116 74 0 0 25.6
## DiabetesPedigreeFunction Age Outcome
## 1 0.627 50 Yes
## 2 0.351 31 No
## 3 0.672 32 Yes
## 4 0.167 21 No
## 5 2.288 33 Yes
## 6 0.201 30 No
f1 <- plot_ly(diabetes, y= ~Glucose, type="violin", box=list(visible=T), meanline=list(visible=T),
name='Glucose', width=1000, height=900) %>%
layout(yaxis=list(title="Value"))
f2 <- plot_ly(diabetes, y= ~BloodPressure, type="violin", box=list(visible=T), meanline=list(visible=T),
name ='BloodPressure', width=1000, height=900) %>%
layout(yaxis=list(title="Value"))
f3 <- plot_ly(diabetes, y= ~SkinThickness, type="violin", box=list(visible=T), meanline=list(visible=T),
name="SkinThickness", width=1000, height=900) %>%
layout(yaxis=list(title="Value"))
f4 <- plot_ly(diabetes, y= ~Insulin, type="violin", box=list(visible=T), meanline=list(visible=T),
width=1000, height=900, name="Insulin") %>%
layout(yaxis=list(title="Value"))
f5 <- plot_ly(diabetes, y= ~BMI, type="violin", box=list(visible=T), meanline=list(visible=T),
width=1000, height=900,name = "BMI") %>%
layout(yaxis=list(title="Value"))
f6 <- plot_ly(diabetes, y= ~DiabetesPedigreeFunction, type="violin", box=list(visible=T), meanline=list(visible=T),
width=1000, height=900, name="DiabetesPedigreeFunction") %>%
layout(yaxis=list(title="Value"))
f7 <- plot_ly(diabetes, y= ~Age, type="violin", box=list(visible=T), meanline=list(visible=T),
width=1000, height=900, name="Age") %>%
layout(yaxis=list(title="Value"))
f8 <- plot_ly(diabetes, y= ~Pregnancies, type="violin", box=list(visible=T), meanline=list(visible=T),
width=1000, height=900, name="Pregnancies") %>%
layout(yaxis=list(title="Value"))
fig <- subplot(f1, f2, f3, f4, nrows=2, titleX=TRUE, titleY=TRUE, margin=0.1)
fig <- fig %>% layout(title=list(text="", font=list(family="Helvetica", size=28)),
font=list(family="Helvetica", size=14),
plot_bgcolor='white')
fig <- fig %>% style(opacity=0.75)
fig
fig <- plot_ly(diabetes, x = ~Pregnancies, y = ~BloodPressure, z = ~BMI, color = ~Outcome)
fig <- fig %>% add_markers()
fig <- fig %>% layout(scene = list(xaxis = list(title = 'Pregnancies'),
yaxis = list(title = 'BloodPressure'),
zaxis = list(title = 'BMI')), annotations = list(
x = 1.13,
y = 1.05,
text = 'BMI',
xref = 'paper',
yref = 'paper',
showarrow = FALSE
))
fig
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels